<form id="formEdit" action="dictionary/kcb/save" class="form-horizontal" role="form" >
    <div class="modal-dialog" role="document">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                <h4 class="modal-title" id="myModalLabel">操作</h4>
            </div>
            <div class="modal-body">

            	<!-- 以下为要修改的的内容 -->

				<input type="hidden" name="id" data-th-value="${model.id}">
				
				<div class="row"> 
	                <div class="form-group col-sm-6">
	                	<label for="txt_kcmc" class="col-sm-5 control-label">课程名称</label>
	                	<div class="col-sm-7">
		                    <input type="text" name="kcmc" data-th-value=${model.kcmc} class="form-control" id="i_kcb_edit_kcmc" placeholder="课程名称">
	                	</div>
	                </div>
	                <div class="form-group col-sm-6">
	                	<label for="txt_kcdm" class="col-sm-5 control-label">课程代码</label>
	                	<div class="col-sm-7">
		                    <input type="text" name="kcdm" data-th-value=${model.kcdm} class="form-control" id="i_kcb_edit_kcdm" placeholder="课程代码">
	                	</div>
	                </div>
                </div>
                <div class="row"> 
	                <div class="form-group col-sm-6">
	                	<label for="txt_zongxs" class="col-sm-5 control-label">总学时</label>
	                	<div class="col-sm-7">
		                    <input type="text" name="zongxs" data-th-value=${model.zongxs} class="form-control" id="i_kcb_edit_zongxs" placeholder="总学时">
	                	</div>
	                </div>
	                <div class="form-group col-sm-6">
	                	<label for="txt_xf" class="col-sm-5 control-label">学分</label>
	                	<div class="col-sm-7">
		                    <input type="text" name="xf" data-th-value=${model.xf} class="form-control" id="i_kcb_edit_xf" placeholder="学分">
	                	</div>
	                </div>
                </div>
                <div class="row"> 
	                <div class="form-group col-sm-6">
	                	<label for="txt_jsxs" class="col-sm-5 control-label">讲授学时</label>
	                	<div class="col-sm-7">
		                    <input type="text" name="jsxs" data-th-value=${model.jsxs} class="form-control" id="i_kcb_edit_jsxs" placeholder="讲授学时">
	                	</div>
	                </div>
	                <div class="form-group col-sm-6">
	                	<label for="txt_syxs" class="col-sm-5 control-label">实验学时</label>
	                	<div class="col-sm-7">
		                    <input type="text" name="syxs" data-th-value=${model.syxs} class="form-control" id="i_kcb_edit_syxs" placeholder="实验学时">
	                	</div>
	                </div>
	            </div>
	            
	            <div class="row"> 
	                <div class="form-group col-sm-6">
	                	<label for="txt_sjxs" class="col-sm-5 control-label">上机学时</label>
	                	<div class="col-sm-7">
		                    <input type="text" name="sjxs" data-th-value=${model.sjxs} class="form-control" id="i_kcb_edit_sjxs" placeholder="上机学时">
	                	</div>
                    </div>
	               <div class="form-group col-sm-6">
	                	<label for="txt_qtxs" class="col-sm-5 control-label">其他学时</label>
	                	<div class="col-sm-7">
		                    <input type="text" name="qtxs" data-th-value=${model.qtxs} class="form-control" id="i_kcb_edit_qtxs" placeholder="其他学时">
	                	</div>
	                </div>
	            </div>
	            
                 <div class="row"> 
	                <div class="form-group col-sm-6">
	                	<label for="txt_zhouxs" class="col-sm-5 control-label">每周学时</label>
	                	<div class="col-sm-7">
		                    <input type="text" name="zhouxs" data-th-value=${model.zhouxs} class="form-control" id="i_kcb_edit_zhouxs" placeholder="每周学时">
	                	</div>
	                </div>
                </div>

                <!-- 以上为要修改的内容 -->

            </div>
            <div class="modal-footer">
                <button type="submit" class="btn btn-primary"><span class="glyphicon glyphicon-floppy-disk" aria-hidden="true"></span>保存</button>
                <button type="button" class="btn btn-default" data-dismiss="modal"><span class="glyphicon glyphicon-remove" aria-hidden="true"></span>关闭</button>
            </div>
        </div>
    </div>
</form>
<script type="text/javascript" th:inline="javascript">
 	var options= {
 			excluded : [':disabled'],
			message: '验证不通过',
			feedbackIcons: {
                 valid: 'glyphicon glyphicon-ok',
                 invalid: 'glyphicon glyphicon-remove',
                 validating: 'glyphicon glyphicon-refresh'
             },
             fields: { 
            	 kcmc: {
            		 validators: {
    					notEmpty: {
    						message: '内容不能为空'
    					}
    				}
    			},
    			kcdm: {
    				validators: {
    					notEmpty: {
    						message: '内容不能为空'
    					}
    				}
    			},
    			zongxs: {
    				validators: {
    					notEmpty: {
    						message: '内容不能为空'
    					},
    					regexp: {
                            regexp: /^[0-9]*$/,
                            message: '请输入数字'
                        }
    				}
    			},
    			xf: {
    				validators: {
    					notEmpty: {
    						message: '内容不能为空'
    					},
    					regexp: {
                            regexp: /^\d+(\.\d+)?$/,
                            message: '请输入正确的学分(正小数)'
                        }
    				}
    			},
    			jsxs: {
    				validators: {
    					notEmpty: {
    						message: '内容不能为空'
    					},
    					regexp: {
                            regexp: /^[0-9]*$/,
                            message: '请输入数字'
                        }
    				}
    			},
    			syxs: {
    				validators: {
    					notEmpty: {
    						message: '内容不能为空'
    					},
    					regexp: {
                            regexp: /^[0-9]*$/,
                            message: '请输入数字'
                        }
    				}
    			},
    			sjxs: {
    				validators: {
    					notEmpty: {
    						message: '内容不能为空'
    					},
    					regexp: {
                            regexp: /^[0-9]*$/,
                            message: '请输入数字'
                        }
    				}
    			},
    			qtxs: {
    				validators: {
    					notEmpty: {
    						message: '内容不能为空'
    					},
    					regexp: {
                            regexp: /^[0-9]*$/,
                            message: '请输入数字'
                        }
    				}
    			},
    			zhouxs: {
    				validators: {
    					notEmpty: {
    						message: '内容不能为空'
    					},
    					regexp: {
                            regexp: /^[0-9]*$/,
                            message: '请输入数字'
                        }
    				}
    			}
             }
         };
        $('#formEdit').bootstrapValidator(options).on('success.form.bv', function(e) {
        	e.preventDefault();							   	//很重要没有它则会提交默认表单，不会做下面的ajax表单提交
            var fd = new FormData($("#formEdit")[0]); 
            var url=$('#formEdit').attr('action');
        	$.ajax({ 
              url: url,  
              type: "POST",  
              data: fd,  
              processData: false,  // 不处理数据  
              contentType: false,   // 不设置内容类型
              success:function(result){
            	  if(result.success){
	            	  $('#myModal').modal("hide");
            	  }else{
            		  bootbox.alert(result.msg);
            	  }
              },
              error:function(result){
            	  bootbox.alert("保存请求发送失败，请检查网络是否连通");
              }
            });  
    	});

</script>